package cn.edu.pku.wxlib.common.util;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import cn.edu.pku.wxlib.vo.sessionmodel.SessionUser;

public class SessionUserUtil {

	private final static String KEY = "login";
	
	//获取session中用户信息
	public static SessionUser getSessionUser(HttpServletRequest request){
		HttpSession session = request.getSession();
		SessionUser user = (SessionUser) session.getAttribute(KEY);
		return user;
	}
	
	//将用户信息加到session
	public static void setSessionUser(HttpServletRequest request,SessionUser user){
		HttpSession session = request.getSession();
		session.setAttribute(KEY, user);
	}
}
